package org.invigorare.auctions.comm;

/* The success or failure code for one synced database row, with associated data */

public class EntrySyncResult {
	
	public enum Status {
		SUCCESS,
		SERVER_ERROR, // need to give a string or other object
		NO_CONNECTION,
		EXCEPTION;
	}
	
	final Status status;
	final Object extraInfo;
	
	public EntrySyncResult(Status status, Object extraInfo) {
		this.status = status;
		this.extraInfo = extraInfo;
	}
	
	public String getObjectAsString() {
		if (extraInfo instanceof String) {
			return (String)extraInfo;
		} else if (extraInfo instanceof Exception) {
			return ((Exception)extraInfo).getMessage();
		} else {
			return "";
		}
	}
	
}
